package com.ft.oa.web.development;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ft.oa.domain.development.ProductVersion;
import com.ft.oa.domain.dto.ApiResult;
import com.ft.oa.domain.sys.SysUser;
import com.ft.oa.service.development.ProductVersionService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 研发-产品-版本
 */
@RestController
@RequestMapping("/dev/product/version")
public class ProductVersionController {

    @Resource
    private ProductVersionService productVersionService;

    /**
     * 产品负责人列表
     * @return
     */
    @GetMapping("/chiefList")
    public ApiResult versionChiefList(){

        List<SysUser> list = productVersionService.versionChiefList();

        return ApiResult.successWithData(list);
    }

    /**
     * 产品版本列表
     * @return
     */
    @PostMapping("/list")
    public ApiResult list(@RequestBody ProductVersion condition){

        List<ProductVersion> list = productVersionService.list(condition);

        return ApiResult.successWithData(list);
    }

    /**
     * 添加版本信息
     * @param productVersion
     * @return
     */
    @PostMapping("/add")
    public ApiResult add(@RequestBody ProductVersion productVersion){

        productVersionService.add(productVersion);
        return ApiResult.simpleSuccess();

    }

    /**
     * 修改版本线信息
     * @param productVersion
     * @return
     */
    @PostMapping("/edit")
    public ApiResult edit(@RequestBody ProductVersion productVersion){
        productVersionService.edit(productVersion);
        return ApiResult.simpleSuccess();
    }

    /**
     * 删除版本
     * @return
     */
    @PostMapping("/del")
    public ApiResult del(@RequestBody ProductVersion version){
        productVersionService.del(version);
        return ApiResult.simpleSuccess();
    }

    /**
     * 分页条件查询
     * @param
     * @return
     */
    @PostMapping("/page")
    public ApiResult page(@RequestBody ProductVersion version){
        Page<ProductVersion> productLine= productVersionService.page(version);
        return ApiResult.successWithData(productLine);
    }




}
